﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel.DataAnnotations;

namespace AvansRS.Domain
{
    public class Registration
    {
        public virtual int ID { get; set; }

        [Required]
        public virtual Entity Entity { get; set; }
        [Required]
        public virtual EventDate EventDate { get; set; }
        [Required]
        public virtual TimeBlock TimeBlock { get; set; }

        public override bool Equals(object obj)
        {
            if (ReferenceEquals(null, obj)) return false;
            if (ReferenceEquals(this, obj)) return true;
            if (obj as Registration == null) return false;
            return Equals((Registration)obj);
        }

        public virtual bool Equals(Registration obj)
        {
            if (ReferenceEquals(null, obj)) return false;
            if (ReferenceEquals(this, obj)) return true;
            return obj.EventDate.ID == EventDate.ID && obj.Entity.ID == Entity.ID;
        }

        public override int GetHashCode()
        {
            return ("" + EventDate.ID + Entity.ID).GetHashCode();
        }

        public override string ToString()
        {
            //return string.Format("Prod Id: {0}, Doc Id: {2}, Person Name: {1}", Rooster.ID, Person.FirstName, HourLayout.ID);
            return string.Format("Prod Id: {0}, Doc Id: {1}", EventDate.ID, Entity.ID);
        }
    }
}
